/**
 * 
 */
package com.app.dao.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.app.dao.BaseDao;
import com.app.dao.IFileDao;
import com.app.dao.po.CornFiles;

/**
 * @author yuxk
 * 
 */
public class FileDaoImpl<T> extends BaseDao<T> implements IFileDao {

	private static Logger logger = Logger.getLogger(FileDaoImpl.class);

	public FileDaoImpl() {
		super();
		logger.info(this.getClass() + " loader");
	}

	@Override
	public int save(CornFiles file) {
		// TODO Auto-generated method stub
		super.getHibernateTemplate().save(file);
		return 0;
	}

	@Override
	public List<CornFiles> selectFileByCornDBId(String id) {
		DetachedCriteria cri=DetachedCriteria.forClass(CornFiles.class);
		cri.add(Restrictions.eq("cornDbDna.id", id));
		List<CornFiles> files=super.getHibernateTemplate().findByCriteria(cri);
		// TODO Auto-generated method stub
		return files;
	}

	

}
